package com.example.controller;

import com.example.common.model.CommonResult;
import com.example.common.utils.CurrentUserUtil;
import com.example.entity.vo.MenuVo;
import com.example.service.MenuService;
import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @Author: zhuxiaokang
 * @CreateTime: 2025-04-30
 * @Description: 菜单
 * @Version: 1.0
 */

@RestController
@RequestMapping("/menu")
public class MenuController {

    @Resource
    private MenuService menuService;


    @RequestMapping("/list")
    public CommonResult<List<MenuVo>> list() {

        Long userId = CurrentUserUtil.getCurrentUser().getUserId();

        List<MenuVo> menuList = menuService.getMenuList(userId.intValue());

        return CommonResult.success(menuList);
    }
}
